{

  interface BaseInfo{
    name: string;
  }

  //声明一个接口  名字满足标识符要求即可, 大小写随意, 一般都是大写字母开头
  interface BoyFriend extends BaseInfo{
    readonly id: number;
    age: number;
    car ?: string;
    cook: () => void;
    makeMoney: () => number;
    repair ?: (jiqi: string) => void;
  }

  //声明一个接口
  interface Programmer extends BaseInfo{
    code: (language: string) => void;
  }

  let me: BoyFriend & Programmer;
  me = {
    id: 1,
    name: 'xiaohigh',
    age: 35,
    cook: () => {
      console.log('我会煮方便面~~');
    },
    makeMoney: () => {
      return 2000;
    },
    repair: (jiqi: string) => {
      console.log(`我可以维修 ${jiqi}`);
    },
    code: () => {
      console.log('我可以编程哦~~~');
    }
  }

  let you: BoyFriend = {
    id: 2,
    name: '吴彦祖',
    age: 46,
    car: '雅迪',
    cook: () => {
      console.log('我什么都会做~~~');
    },
    makeMoney: () => {
      return 2000000;
    }
  }

  //约束一类对象的结构  implements 实现接口
  class Student implements BoyFriend, Programmer{
    //声明属性
    id: number;
    name: string;
    age: number;
    car ?: string;

    //声明构造方法
    constructor(id: number, name: string, age: number, car ?: string){
      this.id = id;
      this.name = name;
      this.age = age;
      this.car = car;
    }

    cook(){
      console.log('我能做饭啦~~');
    }

    makeMoney(){
      return 3520;
    }

    code(language: string) {
      console.log(`我可以编写 ${language}哦~`);
    }

  }

  //实例化对象
  let jiandong = new Student(520, '剑东', 25, '比亚迪');
  let tianyun = new Student(521, '天运', 26, '长安~');

  jiandong.code('JavaScript')
  tianyun.code('Java')
  
}